home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-03-30 | 2.4 KB | 56 lines | [TEXT/GEOL] |
- Item 8319507 29-March-90 20:58PST
-
- From: MADA2 MacApp Dev Assoc, Curtis Faith,IVC
-
- To: POWERUP.DEV Power Up Software,PRT
-
- cc: MACAPP.TECH$ MacApp Technical
-
- Sub: RE(2) FindObject() and FindVa
-
- James,
-
- To reaffirm Jeff's statement I too think that one should be able to pass a
- method just like one can now pass a local procedure. This comes up quite often
- and is a much more general problem.
-
- Your FindObject proposal appears useful (in fact I have done the same thing
- once or twice). It requires no additional OVERRIDE's since one would have had
- to OVERRIDE Compare anyway, and it is a logical extension to GetEqualItemNo.
- Though, I would call it GetEqualObject to be more consistent with
- GetEqualItemNo and to make it obvious that it is not necessarily the same as
- the object you pass in as a parameter.
-
- You state that "I keep having to include the #$!@% TestItem() function in my
- code, as a local function to the routine that calls search(). This wastes my
- time, clutters my code, and increases the change of error - specifically, that
- the various versions of TestItem() won't match."
-
- I gather from the above that you often use a particular identical (at least you
- hope) TestItem as a local procedure parameter to a bunch of Search calls in
- various parts of your application.
-
- Perhaps I am missing something but:
-
- Why could you not simply subclass TSortedList and provide a new method
- TMySortedList.FindSomeObjectThatIWant that uses the particular TestItem
- mentioned above. You would use FindSomeObjectThatIWant instead of
- Search(TestItem). You would have only one instance of TestItem to worry about
- and your code would be more readable since you could name the method in a way
- that lends meaning (FindOldestObject, FindBiggestObject, etc.).
-
- I fail to see any advantage to FindValue as a generic routine. Why not
- encapsulate all the finding into another method that you call something else as
- I describe above? FindValue also limits a particular object to having only
- one search criterion unless one bypasses it and uses Search directly. Having
- one search done via an OVERRIDE to CompareValue and one or more via calls to
- Search directly would be really confusing.
-
- With your proposed solution you still have to OVERRIDE so I don't really see
- where anything is gained, and I for one find the current scheme confusing
- enough already.
-
- - Curtis
-
-
-